package com.lemon.stock.dao

import androidx.room.*
import com.lemon.stock.entity.Batch
import com.lemon.stock.entity.Trade

@Dao
interface BatchDao {


    @Query("SELECT * FROM batch WHERE stock_id= :stockId ORDER BY invest_index ASC")
    fun getList(stockId: String): List<Batch>

    @Query("SELECT * FROM batch WHERE stock_id = :id AND invest_index = :index")
    fun getEntity(id: String, index: Int): Batch

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(vararg batch: Batch)

    @Update
    fun update(vararg batch: Batch)

    @Query("DELETE FROM batch")
    fun clear()
}